{*******************************************************************************
* The contents of this file are used with permission, subject to the Mozilla   *
* Public License Version 1.1 (the "License"); you may not use this file except *
* in compliance with the License. You may obtain a copy of the License at      *
* http://www.mozilla.org/MPL/                                                  *
*                                                                              *
* Software distributed under the License is distributed on an "AS IS" basis,   *
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for *
* the specific language governing rights and limitations under the License.    *
*                                                                              *
* The Original Code is distributed as part of the "mediate" product and is     *
* Copyright (C) @home media limited. All Rights Reserved.                      *
*                                                                              *
* Email: support@athomemedia.co.uk                                             *
* Web:   http://www.athomemedia.co.uk                                          *
*******************************************************************************}

unit BaseAbout;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BaseMsgForm, StdCtrls, ExtCtrls, pngimage;

type
  TfrmBaseAbout = class(TfrmBaseMessage)
    procedure FormCreate(Sender: TObject);
    procedure btCentreClick(Sender: TObject);
  private
    { Private declarations }
    FDescription: String;
    procedure SetDescription(Description: String);
  public
    { Public declarations }
    property Description: String read FDescription write SetDescription;
    class function ShowAboutBox: TModalResult; overload;
    class function ShowAboutBox(Description: String): TModalResult; overload;
  end;


var
  frmBaseAbout: TfrmBaseAbout;

implementation

{$R *.dfm}

uses Utilities;


procedure TfrmBaseAbout.SetDescription(Description: String);
begin
  FDescription := Description;
  lbDesc.Caption := FDescription + sLineBreak + sLineBreak + STANDARD_DESCRIPTION;
end;

procedure TfrmBaseAbout.FormCreate(Sender: TObject);
begin
  inherited;

  // Determine name and version number from exe properties
  lbVersion.Caption := 'version ' + ApplicationVersion;
  lbTitle.Caption := ApplicationName;
end;

procedure TfrmBaseAbout.btCentreClick(Sender: TObject);
begin
  inherited;

  DisplayBrowserHome;
end;

class function TfrmBaseAbout.ShowAboutBox: TModalResult;
begin
  // Delegate to method below
  Result := ShowAboutBox('');
end;

class function TfrmBaseAbout.ShowAboutBox(Description: String): TModalResult;
var
  About: TfrmBaseAbout;
begin
  // Configure description & show modally
  About := Self.Create(Application.MainForm);
  try
    About.PopupParent := Application.MainForm;
    About.Description := Description;
    Result := About.ShowModal;
  finally
    About.Free;
  end;
end;


end.
